<template>
  <div class="app-container">
    <div>
      <el-row :gutter="10">
        <el-col :span="6" :xs="24" :lg="24">
          <div class="bgwhite plr20 ptb20 radius10 flex-col">
            <div class="justify-between w100p">
              <div class="clr3c4 bold ft26">編輯</div>
              <div class="clr9fa align-center pointer" @click="back()">
                <el-icon>
                  <Back />
                </el-icon>
                返回上一頁
              </div>
            </div>
            <div class="mt40">
              <el-form :label-position="labelPosition" label-width="auto" :model="formLabelAlign.formInfo" style="max-width: 600px">
                <el-form-item label="ID:">
                  <el-input v-model="formLabelAlign.formInfo.id" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="用戶訊息:">
                  <el-input v-model="formLabelAlign.formInfo.uid" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="昵稱:">
                  <el-input v-model="formLabelAlign.formInfo.nickname" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="身高:">
                  <el-input v-model="formLabelAlign.formInfo.height" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="體重(Kg):">
                  <el-input v-model="formLabelAlign.formInfo.weight" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="城市:">
                  <el-input v-model="formLabelAlign.formInfo.city" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="手機號:">
                  <el-input v-model="formLabelAlign.formInfo.phone" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="簡介:">
                  <el-input v-model="formLabelAlign.formInfo.introduction" disabled style="width: 380px;" placeholder="請輸入用戶名" />
                </el-form-item>
                <el-form-item label="首頁推薦:">
                  <el-radio-group v-model="formLabelAlign.formInfo.is_recommend" class="ml-4">
                    <el-radio value="1" size="large">是</el-radio>
                    <el-radio value="0" size="large">否</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="是否凍結:">
                  <el-radio-group v-model="formLabelAlign.formInfo.is_freeze" class="ml-4">
                    <el-radio value="1" size="large">是</el-radio>
                    <el-radio value="0" size="large">否</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
              <div class="mt40 mb15 flex-cen ">
                <div class="align-center">
                  <el-button class="btn1" @click="reset()">重置</el-button>
                  <el-button class="btn2" @click="submit()">提交</el-button>
                </div>

              </div>
            </div>


          </div>

        </el-col>


      </el-row>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router';
import type { FormProps } from 'element-plus'
import { playwithEdit } from '@/api/player.js'

onMounted(() => {
  console.log('陪玩數據', route.query)
  formLabelAlign.formInfo = route.query

})
const labelPosition = ref<FormProps['labelPosition']>('right')

const route = useRoute()
const reset = () => {
  formLabelAlign.formInfo.is_recommend = '0'
  formLabelAlign.formInfo.is_freeze = '0'
}
const submit = () => {
  playwithEdit({
    id: formLabelAlign.formInfo.uid,
    is_recommend: formLabelAlign.formInfo.is_recommend,
    is_freeze: formLabelAlign.formInfo.is_freeze
  }).then((res) => {
    console.log('陪玩編輯', res)
    back()
  })
}
const formLabelAlign = reactive({
  formInfo: {}
})
const router = useRouter()
const back = () => {
  router.back()
}
</script>
<style scoped >
:deep(.el-upload--picture-card) {
  background-color: transparent;
  border: none;
}

:deep(.el-input) {
  box-shadow: none;
}
</style>